#ifndef MUTASTRANGEATTRACTOR_H
#define MUTASTRANGEATTRACTOR_H

#include <QObject>

#include "MutaObject.h"
#include "QObject"
#include "ControlPoint.h"
#include "MutaAttractor.h"

class MutaStrangeAttractor : public MutaObject, public QGraphicsPathItem
{
    Q_OBJECT
public:
    MutaStrangeAttractor(QString owner,QPointF p1,QPointF p2,int layer);

    virtual void setPos(const QPointF &pos);
    void setFinalPoint(QPointF p);
    void addControlPoint(QPointF p);
    void setPoint(int num, QPointF p);
    int getLayer();
    QStringList getProperties();
    int type() const;

protected:
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
    void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
    QVariant itemChange(GraphicsItemChange change, const QVariant &value);

private:
    QList<ControlPoint*> controlPoints;
    void buildPath();
    void setColor();
    int time;
    QColor boxColor;
    QBrush boxBrush;
    QPen boxPen;
    int layer;
    //MutaAttractor attractor;


    //Attractor memeber

    //QPixmap sMap;
    //QPolygonF sPoly;

    /**
    *   renderAttractor creates a new pixmap of the given dimensions and render a strange attractor in it
    *   @param int The width of the pixmap
    *   @param int The height of the pixmap
    */
    QPolygonF renderAttractor();

    /** QPainterPath used internally to create the points of the attractor */
    QPainterPath sPath;

    /** QPainter paints the actual attractor into the pixmap */
    QPainter sPainter;

    int frames;
    int iters;
    int skipIters;
    double sensitivity;
    float dispersion;


signals:
    void ellipseAdded(QGraphicsItem* ellipse);

public slots:
    void cPointMoved(QPointF pos,int num);

};
#endif // MUTASTRANGEATTRACTOR_H
